package top.zt9.config;

import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 任务初始化配置
 */
@Configuration
public class MonitorQueueConfig {


    /**
     * 配置任务的执行周期
     * @return
     */
    @Bean
    public JobConfiguration monitorQueueJob(){
        JobConfiguration jobConfig = JobConfiguration.newBuilder("MonitorQueueMessageJob", 1).cron("0,30 * * * * ?").build();
        return jobConfig;
    }

    /**
     * 配置到ScheduleJobBootstrap
     */
//    @Bean
//    public ScheduleJobBootstrap monitorQueueBootstrap(CoordinatorRegistryCenter zookeeperRegistryCenter,
//                                                      MonitorQueueMessageJob monitorQueueMessageJob,
//                                                      JobConfiguration monitorQueueJob){
//        ScheduleJobBootstrap jobBootstrap = new ScheduleJobBootstrap(zookeeperRegistryCenter,monitorQueueMessageJob,monitorQueueJob);
//        jobBootstrap.schedule();
//        return jobBootstrap;
//    }


}
